package com.seata.demo.storage.mapper;

import com.seata.demo.storage.entity.Storage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface StorageMapper {
    Storage selectByCommodityCode(@Param("commodityCode") String commodityCode);
    
    int deduct(@Param("commodityCode") String commodityCode, @Param("count") Integer count);
    
    // TCC模式方法
    int freeze(@Param("commodityCode") String commodityCode, @Param("count") Integer count);
    
    int unfreeze(@Param("commodityCode") String commodityCode, @Param("count") Integer count);
    
    int confirmDeduct(@Param("commodityCode") String commodityCode, @Param("count") Integer count);
}
